package pl.lodz.p.model;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.PrimaryKeyJoinColumn;

@Entity
public class Schedule {

	public static int VISIT_TIME = 1000*60*15; //15 minut na wizyte
	
	@Id
	@GeneratedValue
	private int id;
	
	@ManyToOne
	@PrimaryKeyJoinColumn
	private Doctor doctor;
	
	@Column
	private Date dateStart;
	
	@Column
	private Date dateEnd;
	
	@OneToMany(mappedBy="schedule", cascade=CascadeType.ALL, fetch=FetchType.LAZY)
	private List<Visit> visits;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date getDateStart() {
		return dateStart;
	}

	public void setDateStart(Date dateStart) {
		this.dateStart = dateStart;
	}

	public Date getDateEnd() {
		return dateEnd;
	}

	public void setDateEnd(Date dateEnd) {
		this.dateEnd = dateEnd;
	}

	public Doctor getDoctor() {
		return doctor;
	}

	public void setDoctor(Doctor doctor) {
		this.doctor = doctor;
	}

	public List<Visit> getVisits() {
		return visits;
	}

	public void setVisits(List<Visit> visits) {
		this.visits = visits;
	}

}
